package org.tedu.weibo.common.result;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private Integer status;
    private String message;
    private Object date;

    public JsonResult(StatusCode statusCode) {
        this.status = statusCode.getStatusCode();
        this.message = statusCode.getMessage();
    }

    public JsonResult(StatusCode statusCode, Object date) {
        this(statusCode);
        this.date = date;
    }

    public static JsonResult success(Object data) {
        return new JsonResult(StatusCode.OPERATION_SUCCESS, data);
    }

    public static JsonResult success() {
        return success(null);
    }
}
